package ntrees.hu.pxinput;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.Log;

public abstract class Line {
	abstract public float length();
	abstract public Position getPosition(float off);
	public void draw(Canvas canvas) {
		float length = length();
		Paint paint = new Paint();
		paint.setColor(Color.RED);
		for (int i = 0; i < 10; i++) {
			if (i == 0)
				continue;
			Position pstart = getPosition((i - 1)*length/10);
			Position pend = getPosition((i)*length/10);
			//Log.d("draw line: ", pstart.toString() + pend.toString());
			canvas.drawLine((float)pstart.x, (float)pstart.y, (float)pend.x, (float)pend.y, paint);
		}
	}
}
